﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GameServer.Virtual_Objects.Room;
using GameServer.Virtual_Objects.User;

namespace GameServer.Networking.Handlers
{
    class HANDLE_LEAVE_VEHICLE : PacketHandler
    {
        public override void Handle(Virtual_Objects.User.virtualUser User)
        {
            try
            {
                User.Room.send(new Packets.PACKET_JOIN_VEHICLE(getAllBlocks()));
            }
            catch
            { }
        }
    }
    class HANDLE_MULTIPLAYER_ZOMBIE : PacketHandler
    {
        public override void Handle(Virtual_Objects.User.virtualUser User)
        {
            try
            {
                Virtual_Objects.Room.virtualRoom Room = User.Room;
                foreach (virtualUser RoomUser in Room.Players)
                {
                    if (!RoomUser.Equals(User))
                    {
                        RoomUser.send(new Packets.PACKET_MULTIPLAYER_ZOMBIE(getAllBlocks()));
                        User.send(new Packets.PACKET_MULTIPLAYER_ZOMBIE(getAllBlocks()));
                    }
                }
            }
            catch (Exception ex)
            {
                Log.WriteError("Error at HANDLE_MULTIPLAYER_ZOMBIE: " + ex.Message);
            }
        }
    }
}
